/*
 * @lc app=leetcode.cn id=1603 lang=typescript
 *
 * [1603] 设计停车系统
 */

// @lc code=start
class ParkingSystem {
    store: { big: number; medium: number; small: number };
    constructor(
        public big: number,
        public medium: number,
        public small: number
    ) {
        this.store = {
            big,
            medium,
            small,
        };
    }

    private temp = ["big", "medium", "small"] as const;
    addCar(carType: number): boolean {
        const last = this.store[this.temp[carType - 1]];
        if (last === 0) return false;
        this.store[this.temp[carType - 1]]--;
        return true;
    }
}

/**
 * Your ParkingSystem object will be instantiated and called as such:
 * var obj = new ParkingSystem(big, medium, small)
 * var param_1 = obj.addCar(carType)
 */
// @lc code=end
